package com.web.dao;

import com.web.entity.UserDesigner;
import org.apache.ibatis.annotations.*;

public interface UserDesignerMapper {
    @Delete({
        "delete from APP_USER_DESIGNER",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into APP_USER_DESIGNER (user_id, logo, ",
        "name, create_year, ",
        "case_experience, skill, ",
        "auth_status, create_time, ",
        "modify_time)",
        "values (#{userId,jdbcType=VARCHAR}, #{logo,jdbcType=VARCHAR}, ",
        "#{name,jdbcType=VARCHAR}, #{createYear,jdbcType=VARCHAR}, ",
        "#{caseExperience,jdbcType=VARCHAR}, #{skill,jdbcType=VARCHAR}, ",
        "#{authStatus,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{modifyTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(UserDesigner record);

    int insertSelective(UserDesigner record);

    @Select({
        "select",
        "id, user_id, logo, name, create_year, case_experience, skill, auth_status, create_time, ",
        "modify_time",
        "from APP_USER_DESIGNER",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    UserDesigner selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(UserDesigner record);

    @Update({
        "update APP_USER_DESIGNER",
        "set user_id = #{userId,jdbcType=VARCHAR},",
          "logo = #{logo,jdbcType=VARCHAR},",
          "name = #{name,jdbcType=VARCHAR},",
          "create_year = #{createYear,jdbcType=VARCHAR},",
          "case_experience = #{caseExperience,jdbcType=VARCHAR},",
          "skill = #{skill,jdbcType=VARCHAR},",
          "auth_status = #{authStatus,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "modify_time = #{modifyTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(UserDesigner record);

    UserDesigner findUserDesigner(@Param("key") String key,@Param("value") String value);
}